package com.yootk;
import  java.util.concurrent.ThreadFactory;
class YootKThreadFactory implements  ThreadFactory{
    private  static  final  ThreadFactory INSTANCE = new YootKThreadFactory();
    private  static final String TITLE = "yootk-";
    private static int count = 0;
    private  YootKThreadFactory(){}
    public  static  ThreadFactory getInstance(){
        return  INSTANCE;
    }
    @Override
    public Thread newThread(Runnable run){
        return new Thread(run. TITLE + count++);
    }
}
public class YootkDemo {
    public static void main(String[] args) throws Exception{
        Thread thread = YootKThreadFactory.getInstance().newThread(()-> {
            System.out.println("多线程执行，" + Thread.currentThread().getName());
        })
                thread.start();
    }
}
